//


#import "MB_SuperViewController.h"

@interface MB_SuperViewController ()

@end

@implementation MB_SuperViewController

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self setupidiaoowSetting];
    if (self.bm_isShowLeftswqrrSetting) {
      PostNotifition(@"tabbarHide");
    }else{
      PostNotifition(@"tabbarShow");
    }
    
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self.navigationController.navigationBar setBarTintColor:RGB(255 ,228 ,225)];
    // 去掉
    self.navigationController.navigationBar.shadowImage = [[UIImage alloc] init];
    self.view.backgroundColor = [UIColor whiteColor];
    
}

//*
- (void)setupidiaoowSetting
{
    if (self.bm_isShowLeftswqrrSetting) {
        
        UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 25, 25)];
        [button setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
        [button addTarget:self action:@selector(ActionbmBack) forControlEvents:UIControlEventTouchUpInside];
        UIBarButtonItem *leftItem = [[UIBarButtonItem alloc]initWithCustomView:button];
        self.navigationItem.leftBarButtonItem = leftItem;
        
    }
}

//
- (void)setupLeftyqwnvjqAndRightSetting:(id)obj block:(BMNavRightBlock)block
{
    _bmNavRightBlock = block;
    if ([obj isKindOfClass:[NSString class]]) {
        UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 40, 30)];
        [button setTitle:obj forState:UIControlStateNormal];
        [button setTitleColor:RGBA(51, 51, 51, 1) forState:UIControlStateNormal];
        [button addTarget:self action:@selector(OnClick:) forControlEvents:UIControlEventTouchUpInside];
        [button.titleLabel setFont:FontPFRegular(kRWidth(15))];
        UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]initWithCustomView:button];
        self.navigationItem.rightBarButtonItem = rightItem;
    }else if ([obj isKindOfClass:[UIImage class]]){
        UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 25, 25)];
        [button setImage:obj forState:UIControlStateNormal];
        [button addTarget:self action:@selector(OnClick:) forControlEvents:UIControlEventTouchUpInside];
        UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]initWithCustomView:button];
        self.navigationItem.rightBarButtonItem = rightItem;
    }
}
- (void)setnavBatalweeTitle:(NSString *)title
{
    [self bm_isShowLeftswqrrSetting];
    self.navigationItem.title = title;
    [self.navigationController.navigationBar setTitleTextAttributes:
     @{NSFontAttributeName:[UIFont systemFontOfSize:20],
       NSForegroundColorAttributeName:RGB(51, 51, 51)}];
}

#pragma mark - ClickAction
//MARK:右键j点击
- (void)OnClick:(UIButton*)button {
    if (self.bmNavRightBlock) {
        self.bmNavRightBlock();
    }
}

//返回
- (void)ActionbmBack
{
    [self.navigationController popViewControllerAnimated:YES];
}


- (BOOL)bm_isShowLeftswqrrSetting
{
    return YES;
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
